<template>
    <view>
        <excellentCourseList v-for="(item,index) in list" :key="index" class="item" :data="item"></excellentCourseList>
    </view>
</template>
<script>
import excellentCourseList from '@/components/excellent-course-list'
import {
		getGradeList,
	} from '@/api/product';
export default {
    components:{excellentCourseList},
    data(){
        return{
            list:[],
            page:1,
            type:0,
            subject_id:''
        }
    },
    onLoad(options){
        this.type = options.type
        if(this.type==1){
            this.subject_id = 0
            
        }else{
            this.subject_id=''
            
        }
        uni.setNavigationBarTitle({
                title:options.title
            })
        this.getGradeList()
    },
    methods:{
        async getGradeList(){
            const res = await this.$http.post(`${getGradeList}`,
                {type:this.type,page:this.page,limit:10,subject_id:this.subject_id},
                {
                    header: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                    }
                }
            )
            if(res.data && res.data.length>0){
                this.list = res.data
            }
            
        }
    }
}
</script>